package com.smh.aiagent.demo.invoke;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author shiminghui
 * @date 2025/5/29 21:06
 * @description: TODO
 */
@Component
public class SpringAiInvoke implements CommandLineRunner { // 实现 CommandLineRunner 接口，在应用程序启动时执行代码

    @Resource(name = "dashscopeChatModel")
    private ChatModel dashScopeChatModel;


    @Override
    public void run(String... args) throws Exception {
//        ChatResponse chatResponse = dashScopeChatModel.call(new Prompt("你好"));
//        for (Generation result : chatResponse.getResults()) {
//            AssistantMessage output = result.getOutput();
//            System.out.println(output.getText());
//        }
    }

}
